function getProducts() {
    return [
        {id: 1, name: '手机', price: 1999, category: '电子产品', image: 'images/icons/phone.jpg', desc: '高性能智能手机'},
        {id: 2, name: '耳机', price: 299, category: '电子产品', image: 'images/icons/earphone.jpg', desc: '无线蓝牙耳机'},
        {id: 3, name: 'T恤', price: 99, category: '服装', image: 'images/icons/tshirt.jpg', desc: '纯棉T恤'},
    ];
}

function getProductById(id) {
    return getProducts().find(p => String(p.id) === String(id));
}